/*
 * RtpTcpParser.h
 *
 *  Created on: 2018年12月14日
 *      Author: terry
 */

#ifndef RTPTCPPARSER_H_
#define RTPTCPPARSER_H_

#include "MediaPacket.h"
#include <string>
#include "RtpPacker.h"
#include "SharedPtr.h"
#include "ByteBuffer.h"

class RtpTcpParser 
{
public:
	RtpTcpParser();
	virtual ~RtpTcpParser();

	bool open(const std::string& filepath, int prefix, const std::string& codec);

	void close();

	bool isOpen();

	bool readPacket(av::MediaPacket& pkt);

protected:
	bool readRtpPacket(av::RtpPacket& pkt);

protected:
	FILE*   m_file;
	int		m_prefix;
	std::shared_ptr< av::RtpUnPacker >	m_unpacker;
	ByteBuffer	m_buffer;

};

#endif /* RTPTCPPARSER_H_ */
